#!/bin/bash
jkbPath=$1
poName=$2

#添加要国际化的相对于templates目录的文件名
file_arr=()
file_arr[0]="newui/task/task_list_all.htm"
file_arr[1]="task_list_inc_date_range.htm"
file_arr[2]="api/task_create.htm"
file_arr[2]="api/task_list.htm"
file_arr[2]="api/task_edit.htm"




#clear .po file
echo "" > "./"${poName}".po"

echo "msgid \"\"" >>  "./"${poName}".po"
echo "msgstr \"\"" >>  "./"${poName}".po"

echo "\"Project-Id-Version: \n\"" >>  "./"${poName}".po"
echo "\"POT-Creation-Date: \n\"" >>  "./"${poName}".po"
echo "\"PO-Revision-Date: \n\"" >>  "./"${poName}".po"
echo "\"Last-Translator: chencheng <cheng.chen@yunzhihui.com>\n\"" >>  "./"${poName}".po"
echo "\"Language-Team: JKB\n\"" >>  "./"${poName}".po"
echo "\"MIME-Version: 1.0\n\"" >>  "./"${poName}".po"
echo "\"Content-Type: text/plain; charset=UTF-8\n\"" >>  "./"${poName}".po"
echo "\"Content-Transfer-Encoding: 8bit\n\"" >>  "./"${poName}".po"

i=0
while [ $i -lt ${#file_arr[@]} ]
do
    #echo ${file_arr[$i]}
		
	php -q ./tsmarty2c.php  ${jkbPath}"/www/templates/"${file_arr[$i]} > "./tmp.po"

	`sed -i '1d' tmp.po`
	`sed -i '1d' tmp.po`

	cat tmp.po >> "./"${poName}".po"

    let i++
done


#生成mo文件
#`msgfmt -o "./"${poName}".mo" "./"${poName}".po"`

`rm -rf ./tmp.po`



